package com.xaicode.locker.JavaSJMS.three.BehaviorMode.State;

/**
 * 状态模式切换
 * @author Locker
 * 	  <br> 2017年5月6日 上午9:37:43
 * @version v1.0
 */
public class ChangeState {

	private State state;  
	  
	public ChangeState(){}
	
    public ChangeState(State state) {  
        this.state = state;  
    }  
  
    public State getState() {  
        return state;  
    }  
  
    public void setState(State state) {  
        this.state = state;  
    }  
  
    public void method() {  
        if (state.getValue().equals("state1")) {  
            state.method1();  
        } else if (state.getValue().equals("state2")) {  
            state.method2();  
        }  
    }  
	
}
